<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            height: 2000px;
        }
    </style>
</head>
<body>
    <h2>PC端视口</h2>

    <script>
        //当可视区域的窗口大小发生改变时
        // window.onresize = function(){
            console.log('可视区域的宽度:' + document.documentElement.clientWidth);
            console.log('可视区域的高度:' + document.documentElement.clientHeight);
            //包含滚动条的宽度
            console.log('浏览器内部的宽度:' + window.innerWidth);
            //xx
            console.log('浏览器的整体宽度:' + window.outerWidth);
        // }

        
    </script>
 
</body>
</html>